package com.jianan.mis.service;

import java.util.List;

import com.jianan.mis.data.dao.GroupDao;
import com.jianan.mis.data.domain.Group;

public class GroupServiceImpl implements GroupService {

	private GroupDao groupDao;

	public void update(Group group) {
		groupDao.saveOrUpdate(group);
	}
	
	public List<Group> getAll() {
		return groupDao.getAll(Group.class, "id", true);
	}

	public Group findByName(String name) {
		return groupDao.findUniqueBy(Group.class, "Name", name);
	}

	public Group findByCode(String code) {
		return groupDao.findUniqueBy(Group.class, "Code", code);
	}

	public void setGroupDao(GroupDao groupDao) {
		this.groupDao = groupDao;
	}

}
